package com.richpencil.config;

import com.alibaba.fastjson.parser.ParserConfig;
import com.jfinal.json.MixedJsonFactory;
import com.jfinal.weixin.sdk.api.ApiConfigKit;
import com.jfinal.weixin.sdk.cache.DefaultAccessTokenCache;
import com.jfinal.weixin.sdk.utils.JsonUtils;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Service;

@Service
public class StartService implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
        ApiConfigKit.setAccessTokenCache(new DefaultAccessTokenCache());
        JsonUtils.setJsonFactory(new MixedJsonFactory());

        ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
    }
}
